<?php

//require 'class/feld.class.php';

class Bild extends Feld {
	
	public $id;
	public $value;
	public $typ;
	public $label;
	public $labelling;
	
	public function Bild($id,$value,$typ,$label,$labelling){
		$this->id = $id;
		$this->value = $value;
		$this->typ = $typ;
		$this->label = $label;
		$this->labelling = $labelling;
	}
	
	public function getCode($wert=null,$label=null,$fehler=null){
		
		$labelType="hidden";
		if($this->labelling){
			$labelType="text";
		}
		
		echo("<tr><td>".$this->typ."</td><td><input type='$labelType' name='".$this->id."label' value='".$this->label."' /></td><td><input type='hidden' name='".$this->id."' value='".$this->value."' /><input type='file' name='".$this->id."' /></td></tr>");
		
		if($fehler!=null){
			echo"<tr><td colspan='3' class='fehlermeldung'>$fehler</td></tr>";
		}
		
	}
	
	public function getVCard($nummer){
		return "";
	}
	
	public static function validate($typ, $wert){
		
		if(exif_imagetype($wert)===false){
			return "Bitte laden Sie einen g&auml;ngigen Datentyp hoch.";
		}
		
		return null;
	}
	
}

?>